package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.ComponentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shkstart
 * @create ${}YEAR-05-26 16:45
 */
@Api(tags = "后台管理系统[组件统计]")
@RequestMapping("/admin")
@RestController
public class ComponentController {

    @Autowired
    private ComponentService componentService;

    @SystemLog(notes = "统计所有组件{后台管理系统}")
    @ApiOperation(value = "统计所有组件接口",notes = "提供后台管理系统-首页所需要的数据")
    @GetMapping
    public ResponseResult componentCount(){
        return componentService.getComponentCount();
    }

    @SystemLog(notes = "获取对应登录类型下的用户区域分布信息{后台管理系统}")
    @ApiOperation(value = "获取对应登录类型下的用户区域分布信息接口")
    @GetMapping("/users/area")
    public ResponseResult getAreaList(@RequestParam("type") Integer type){
        return componentService.getAreaList(type);
    }


}
